package com.ts.Controller;

import com.qf.vo.Goods;
import com.ts.service.ISearchGoodsService;
import com.ts.vo.SearchGoodsParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.IOException;
import java.util.List;

@Controller
@RequestMapping("/searchGoodsController")
public class SearchGoodsController {

    @Autowired
    private ISearchGoodsService goodsService;

    // 按照条件查询【类型，按照关键字，排序】
    @RequestMapping("/search")
    public String search(SearchGoodsParam param, ModelMap modelMap) throws IOException {

        List<Goods> goodsList = goodsService.search(param);

        System.out.println(goodsList);
        modelMap.put("goodsList", goodsList);

        return "searchList";
    }
}
